from PIL import Image, ImageDraw

# 创建画布
img = Image.new('RGB', (600, 300), color=(255, 255, 255))
draw = ImageDraw.Draw(img)

# 绘制标题
draw.text((10, 10), "Distribute 10 Candies to 3 Children", fill=(0, 0, 0))

# 绘制10颗糖果（彩色圆圈表示每颗糖果）
candy_colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (255, 165, 0), (255, 255, 0),
                (255, 105, 180), (138, 43, 226), (64, 224, 208), (255, 69, 0), (173, 216, 230)]

for i in range(10):
    x = 50 + (i % 5) * 50  # 每行5颗糖果
    y = 50 if i < 5 else 100  # 第一行和第二行的位置
    draw.ellipse([x, y, x + 40, y + 40], fill=candy_colors[i], outline=(0, 0, 0))

# 标注分配情况
draw.text((10, 160), "Child 1: 4 Candies", fill=(0, 0, 0))
draw.text((10, 190), "Child 2: 3 Candies", fill=(0, 0, 0))
draw.text((10, 220), "Child 3: 3 Candies", fill=(0, 0, 0))

# 保存图像
img_path = "candy_distribution.png"
img.save(img_path)